package com.chase.springboot.controller;

import com.chase.springboot.model.Role;
import com.chase.springboot.model.User;
import com.chase.springboot.service.RoleService;
import com.chase.springboot.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api("角色管理")
@RestController
public class RoleController {
    @Autowired
    private RoleService roleService;

    @ApiOperation(("添加角色"))
    @PostMapping("/role")
    public boolean insertUser(@RequestBody Role role){
        return roleService.add(role);
    }

    @ApiOperation(("删除角色"))
    @DeleteMapping("/role/{id}")
    public boolean deleteUser(@PathVariable("id")Integer id){
        return roleService.deleteById(id);
    }
}
